﻿@model WebUI.Models.Catalog
<div class="">
    <table class="width">
        <tr>
            <td nowrap="nowrap" width="50%">
                @using (Ajax.BeginForm("CreateSuiFangForm", new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "sft02001", HttpMethod = "Post", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" }))
                {                  
                    <span class="catalog-title">分类</span> @Html.TextBox("NewName", @Model.Title)
                    if (string.IsNullOrEmpty(Model.RootFlag))
                    {
                        <input type="submit" name="submit" value="改名" />
                        @Html.Hidden("TreeID", Model.CatalogID)
                        @Ajax.ActionLink("删除", "DelSuiFangForm", new { ID = Model.CatalogID }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "SuiFangFormView", HttpMethod = "Post", InsertionMode = InsertionMode.Replace, OnSuccess = "$('#sft" + Model.CatalogID + "').remove()", OnFailure = "OnSiteError", Confirm = OnConfirmDel() })
                    }
                }
            </td>
            <td nowrap="nowrap">
                @using (Ajax.BeginForm("CreateSuiFangForm", new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "sft02001", HttpMethod = "Post", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" }))
                {    
                    @Html.Hidden("TreeID", Model.CatalogID)
                    <div style="white-space: nowrap">
                        下级分类： @Html.TextBox("NewName")
                        <input type="submit" name="submit" value="添加" />
                    </div>    
                }
            </td>
        </tr>
    </table>
    <script type="text/javascript">        $(function () { $('input:submit').button(); });</script>
</div>
<h3>
    随访项</h3>
@Ajax.ActionLink("添加", "SuiFangItem", new { SuiFangID = Model.CatalogID }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "dialogbox", OnComplete = "showDialog('随访项');", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
@{ var tm = Model.QizItems.FirstOrDefault(); tm = tm != null ? tm : new WebUI.Models.QizItem();}
<table class="width withhilighter">
    <tr>
        <th>
            @Html.LabelFor(model => tm.Title)
        </th>
        <th>
            @Html.LabelFor(model => tm.TypeRef)
        </th>
        @*        <th>
            @Html.LabelFor(model => tm.Department)
        </th>*@
        <th>
        </th>
    </tr>
    @{int dColor = 0;}
    @foreach (var item in Model.QizItems)
    {
        var cid = @ViewBag.ItemID;
        var color = "#fff";
        if (!string.IsNullOrEmpty(cid) && cid == item.QizItemID)
        {
            color = "orange";
        }
        <tr  class="tr-backColor@(dColor++%2)">
            <td>
                @Html.DisplayFor(model => item.Title)
            </td>
            <td>
                @Html.DisplayFor(model => item.TypeRef.OptionTitle)
                @if (item.TypeRef.OptionValue == "4" || item.TypeRef.OptionValue == "5")
                {   
                    <span>:</span>@Html.DisplayFor(model => item.EnumDefine.EnumName)
                }
            </td>

            <td>
                @Ajax.ActionLink("修改", "SuiFangItem", new { ID = item.QizItemID }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "dialogbox", OnComplete = "showDialog('随访项-" + item.Title.Replace("'", "\\\'") + "');", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
                @Ajax.ActionLink("所属科室", "SuiFangItemToDep", new { ID = item.QizItemID }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "dialogbox", OnComplete = "showDialog('随访项-" + item.Title.Replace("'", "\\\'") + "',true);", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
                | @Ajax.ActionLink("删除", "DelSuiFangItem", new { ID = item.QizItemID }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "SuiFangFormView", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError", Confirm = OnConfirmDel() })
            </td>
        </tr>
    }
</table>
@Html.Partial("TrHilighter", new ViewDataDictionary { { "hitabselector", ".withhilighter" } })
